<?php
if (session_id() == "") session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include_once "ewcfg10.php" ?>
<?php include_once "ewmysql10.php" ?>
<?php include_once "phpfn10.php" ?>
<?php include_once "veh_vehiculosinfo.php" ?>
<?php include_once "usuariosinfo.php" ?>
<?php include_once "vehiculo_cubiertasgridcls.php" ?>
<?php include_once "veh_vehiculo_sucursalgridcls.php" ?>
<?php include_once "userfn10.php" ?>
<?php

//
// Page class
//

$veh_vehiculos_edit = NULL; // Initialize page object first

class cveh_vehiculos_edit extends cveh_vehiculos {

	// Page ID
	var $PageID = 'edit';

	// Project ID
	var $ProjectID = "{0CD3A63A-80C7-457D-BA57-0B97D2A745A8}";

	// Table name
	var $TableName = 'veh_vehiculos';

	// Page object name
	var $PageObjName = 'veh_vehiculos_edit';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		if ($this->UseTokenInUrl) $PageUrl .= "t=" . $this->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v);
	}

	function getFailureMessage() {
		return @$_SESSION[EW_SESSION_FAILURE_MESSAGE];
	}

	function setFailureMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v);
	}

	function getSuccessMessage() {
		return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE];
	}

	function setSuccessMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v);
	}

	function getWarningMessage() {
		return @$_SESSION[EW_SESSION_WARNING_MESSAGE];
	}

	function setWarningMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_WARNING_MESSAGE], $v);
	}

	// Show message
	function ShowMessage() {
		$hidden = FALSE;
		$html = "";

		// Message
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage, "");
		if ($sMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sMessage . "</div>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}

		// Warning message
		$sWarningMessage = $this->getWarningMessage();
		$this->Message_Showing($sWarningMessage, "warning");
		if ($sWarningMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sWarningMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sWarningMessage;
			$html .= "<div class=\"alert alert-warning ewWarning\">" . $sWarningMessage . "</div>";
			$_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session
		}

		// Success message
		$sSuccessMessage = $this->getSuccessMessage();
		$this->Message_Showing($sSuccessMessage, "success");
		if ($sSuccessMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sSuccessMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sSuccessMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sSuccessMessage . "</div>";
			$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session
		}

		// Failure message
		$sErrorMessage = $this->getFailureMessage();
		$this->Message_Showing($sErrorMessage, "failure");
		if ($sErrorMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sErrorMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sErrorMessage;
			$html .= "<div class=\"alert alert-error ewError\">" . $sErrorMessage . "</div>";
			$_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session
		}
		echo "<table class=\"ewStdTable\"><tr><td><div class=\"ewMessageDialog\"" . (($hidden) ? " style=\"display: none;\"" : "") . ">" . $html . "</div></td></tr></table>";
	}
	var $PageHeader;
	var $PageFooter;

	// Show Page Header
	function ShowPageHeader() {
		$sHeader = $this->PageHeader;
		$this->Page_DataRendering($sHeader);
		if ($sHeader <> "") { // Header exists, display
			echo "<p>" . $sHeader . "</p>";
		}
	}

	// Show Page Footer
	function ShowPageFooter() {
		$sFooter = $this->PageFooter;
		$this->Page_DataRendered($sFooter);
		if ($sFooter <> "") { // Footer exists, display
			echo "<p>" . $sFooter . "</p>";
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm;
		if ($this->UseTokenInUrl) {
			if ($objForm)
				return ($this->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($this->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function __construct() {
		global $conn, $Language;
		$GLOBALS["Page"] = &$this;

		// Language object
		if (!isset($Language)) $Language = new cLanguage();

		// Parent constuctor
		parent::__construct();

		// Table object (veh_vehiculos)
		if (!isset($GLOBALS["veh_vehiculos"]) || get_class($GLOBALS["veh_vehiculos"]) == "cveh_vehiculos") {
			$GLOBALS["veh_vehiculos"] = &$this;
			$GLOBALS["Table"] = &$GLOBALS["veh_vehiculos"];
		}

		// Table object (usuarios)
		if (!isset($GLOBALS['usuarios'])) $GLOBALS['usuarios'] = new cusuarios();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'edit', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'veh_vehiculos', TRUE);

		// Start timer
		if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer();

		// Open connection
		if (!isset($conn)) $conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}

		// Create form object
		$objForm = new cFormObj();
		$this->CurrentAction = (@$_GET["a"] <> "") ? $_GET["a"] : @$_POST["a_list"]; // Set up current action
		$this->VehiculoId->Visible = !$this->IsAdd() && !$this->IsCopy() && !$this->IsGridAdd();

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();
		$this->Page_Redirecting($url);

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $DbMasterFilter;
	var $DbDetailFilter;

	// 
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsFormError;

		// Load key from QueryString
		if (@$_GET["VehiculoId"] <> "") {
			$this->VehiculoId->setQueryStringValue($_GET["VehiculoId"]);
		}

		// Set up Breadcrumb
		$this->SetupBreadcrumb();

		// Process form if post back
		if (@$_POST["a_edit"] <> "") {
			$this->CurrentAction = $_POST["a_edit"]; // Get action code
			$this->LoadFormValues(); // Get form values

			// Set up detail parameters
			$this->SetUpDetailParms();
		} else {
			$this->CurrentAction = "I"; // Default action is display
		}

		// Check if valid key
		if ($this->VehiculoId->CurrentValue == "")
			$this->Page_Terminate("veh_vehiculoslist.php"); // Invalid key, return to list

		// Validate form if post back
		if (@$_POST["a_edit"] <> "") {
			if (!$this->ValidateForm()) {
				$this->CurrentAction = ""; // Form error, reset action
				$this->setFailureMessage($gsFormError);
				$this->EventCancelled = TRUE; // Event cancelled
				$this->RestoreFormValues();
			}
		}
		switch ($this->CurrentAction) {
			case "I": // Get a record to display
				if (!$this->LoadRow()) { // Load record based on key
					if ($this->getFailureMessage() == "") $this->setFailureMessage($Language->Phrase("NoRecord")); // No record found
					$this->Page_Terminate("veh_vehiculoslist.php"); // No matching record, return to list
				}

				// Set up detail parameters
				$this->SetUpDetailParms();
				break;
			Case "U": // Update
				$this->SendEmail = TRUE; // Send email on update success
				if ($this->EditRow()) { // Update record based on key
					if ($this->getSuccessMessage() == "")
						$this->setSuccessMessage($Language->Phrase("UpdateSuccess")); // Update success
					if ($this->getCurrentDetailTable() <> "") // Master/detail edit
						$sReturnUrl = $this->GetDetailUrl();
					else
						$sReturnUrl = $this->getReturnUrl();
					$this->Page_Terminate($sReturnUrl); // Return to caller
				} else {
					$this->EventCancelled = TRUE; // Event cancelled
					$this->RestoreFormValues(); // Restore form values if update failed

					// Set up detail parameters
					$this->SetUpDetailParms();
				}
		}

		// Render the record
		$this->RowType = EW_ROWTYPE_EDIT; // Render as Edit
		$this->ResetAttrs();
		$this->RenderRow();
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		if ($this->DisplayRecs == 0)
			return;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
				$this->StartRec = $_GET[EW_TABLE_START_REC];
				$this->setStartRecordNumber($this->StartRec);
			} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
				$PageNo = $_GET[EW_TABLE_PAGE_NO];
				if (is_numeric($PageNo)) {
					$this->StartRec = ($PageNo-1)*$this->DisplayRecs+1;
					if ($this->StartRec <= 0) {
						$this->StartRec = 1;
					} elseif ($this->StartRec >= intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1) {
						$this->StartRec = intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1;
					}
					$this->setStartRecordNumber($this->StartRec);
				}
			}
		}
		$this->StartRec = $this->getStartRecordNumber();

		// Check if correct start record counter
		if (!is_numeric($this->StartRec) || $this->StartRec == "") { // Avoid invalid start record counter
			$this->StartRec = 1; // Reset start record counter
			$this->setStartRecordNumber($this->StartRec);
		} elseif (intval($this->StartRec) > intval($this->TotalRecs)) { // Avoid starting record > total records
			$this->StartRec = intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1; // Point to last page first record
			$this->setStartRecordNumber($this->StartRec);
		} elseif (($this->StartRec-1) % $this->DisplayRecs <> 0) {
			$this->StartRec = intval(($this->StartRec-1)/$this->DisplayRecs)*$this->DisplayRecs+1; // Point to page boundary
			$this->setStartRecordNumber($this->StartRec);
		}
	}

	// Get upload files
	function GetUploadFiles() {
		global $objForm;

		// Get upload data
		$this->VehiculoFotoPrincipal->Upload->Index = $objForm->Index;
		if ($this->VehiculoFotoPrincipal->Upload->UploadFile()) {

			// No action required
		} else {
			echo $this->VehiculoFotoPrincipal->Upload->Message;
			$this->Page_Terminate();
			exit();
		}
		$this->VehiculoFotoPrincipal->CurrentValue = $this->VehiculoFotoPrincipal->Upload->FileName;
		$this->VehiculoFoto2->Upload->Index = $objForm->Index;
		if ($this->VehiculoFoto2->Upload->UploadFile()) {

			// No action required
		} else {
			echo $this->VehiculoFoto2->Upload->Message;
			$this->Page_Terminate();
			exit();
		}
		$this->VehiculoFoto2->CurrentValue = $this->VehiculoFoto2->Upload->FileName;
		$this->VehiculoFoto3->Upload->Index = $objForm->Index;
		if ($this->VehiculoFoto3->Upload->UploadFile()) {

			// No action required
		} else {
			echo $this->VehiculoFoto3->Upload->Message;
			$this->Page_Terminate();
			exit();
		}
		$this->VehiculoFoto3->CurrentValue = $this->VehiculoFoto3->Upload->FileName;
		$this->VehiculoFoto4->Upload->Index = $objForm->Index;
		if ($this->VehiculoFoto4->Upload->UploadFile()) {

			// No action required
		} else {
			echo $this->VehiculoFoto4->Upload->Message;
			$this->Page_Terminate();
			exit();
		}
		$this->VehiculoFoto4->CurrentValue = $this->VehiculoFoto4->Upload->FileName;
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm;
		$this->GetUploadFiles(); // Get upload files
		if (!$this->VehiculoId->FldIsDetailKey)
			$this->VehiculoId->setFormValue($objForm->GetValue("x_VehiculoId"));
		if (!$this->VehiculoDominio->FldIsDetailKey) {
			$this->VehiculoDominio->setFormValue($objForm->GetValue("x_VehiculoDominio"));
		}
		if (!$this->VehiculoTipo->FldIsDetailKey) {
			$this->VehiculoTipo->setFormValue($objForm->GetValue("x_VehiculoTipo"));
		}
		if (!$this->VehiculoDescripcion->FldIsDetailKey) {
			$this->VehiculoDescripcion->setFormValue($objForm->GetValue("x_VehiculoDescripcion"));
		}
		if (!$this->VehiculoSucursal->FldIsDetailKey) {
			$this->VehiculoSucursal->setFormValue($objForm->GetValue("x_VehiculoSucursal"));
		}
		if (!$this->VehiculoFechaCompra->FldIsDetailKey) {
			$this->VehiculoFechaCompra->setFormValue($objForm->GetValue("x_VehiculoFechaCompra"));
			$this->VehiculoFechaCompra->CurrentValue = ew_UnFormatDateTime($this->VehiculoFechaCompra->CurrentValue, 7);
		}
		if (!$this->VehiculoProveedor->FldIsDetailKey) {
			$this->VehiculoProveedor->setFormValue($objForm->GetValue("x_VehiculoProveedor"));
		}
		if (!$this->VehiculoMarca->FldIsDetailKey) {
			$this->VehiculoMarca->setFormValue($objForm->GetValue("x_VehiculoMarca"));
		}
		if (!$this->VehiculoModelo->FldIsDetailKey) {
			$this->VehiculoModelo->setFormValue($objForm->GetValue("x_VehiculoModelo"));
		}
		if (!$this->VehiculoVersion->FldIsDetailKey) {
			$this->VehiculoVersion->setFormValue($objForm->GetValue("x_VehiculoVersion"));
		}
		if (!$this->VehiculoChasis->FldIsDetailKey) {
			$this->VehiculoChasis->setFormValue($objForm->GetValue("x_VehiculoChasis"));
		}
		if (!$this->VehiculoMotor->FldIsDetailKey) {
			$this->VehiculoMotor->setFormValue($objForm->GetValue("x_VehiculoMotor"));
		}
		if (!$this->VehiculoCombustible->FldIsDetailKey) {
			$this->VehiculoCombustible->setFormValue($objForm->GetValue("x_VehiculoCombustible"));
		}
		if (!$this->VehiculoTipoMedicion->FldIsDetailKey) {
			$this->VehiculoTipoMedicion->setFormValue($objForm->GetValue("x_VehiculoTipoMedicion"));
		}
		if (!$this->VehiculoCondicion->FldIsDetailKey) {
			$this->VehiculoCondicion->setFormValue($objForm->GetValue("x_VehiculoCondicion"));
		}
		if (!$this->VehiculoKm->FldIsDetailKey) {
			$this->VehiculoKm->setFormValue($objForm->GetValue("x_VehiculoKm"));
		}
		if (!$this->VehiculoFechaBaja->FldIsDetailKey) {
			$this->VehiculoFechaBaja->setFormValue($objForm->GetValue("x_VehiculoFechaBaja"));
			$this->VehiculoFechaBaja->CurrentValue = ew_UnFormatDateTime($this->VehiculoFechaBaja->CurrentValue, 7);
		}
		if (!$this->VehiculoMotivoBaja->FldIsDetailKey) {
			$this->VehiculoMotivoBaja->setFormValue($objForm->GetValue("x_VehiculoMotivoBaja"));
		}
	}

	// Restore form values
	function RestoreFormValues() {
		global $objForm;
		$this->LoadRow();
		$this->VehiculoId->CurrentValue = $this->VehiculoId->FormValue;
		$this->VehiculoDominio->CurrentValue = $this->VehiculoDominio->FormValue;
		$this->VehiculoTipo->CurrentValue = $this->VehiculoTipo->FormValue;
		$this->VehiculoDescripcion->CurrentValue = $this->VehiculoDescripcion->FormValue;
		$this->VehiculoSucursal->CurrentValue = $this->VehiculoSucursal->FormValue;
		$this->VehiculoFechaCompra->CurrentValue = $this->VehiculoFechaCompra->FormValue;
		$this->VehiculoFechaCompra->CurrentValue = ew_UnFormatDateTime($this->VehiculoFechaCompra->CurrentValue, 7);
		$this->VehiculoProveedor->CurrentValue = $this->VehiculoProveedor->FormValue;
		$this->VehiculoMarca->CurrentValue = $this->VehiculoMarca->FormValue;
		$this->VehiculoModelo->CurrentValue = $this->VehiculoModelo->FormValue;
		$this->VehiculoVersion->CurrentValue = $this->VehiculoVersion->FormValue;
		$this->VehiculoChasis->CurrentValue = $this->VehiculoChasis->FormValue;
		$this->VehiculoMotor->CurrentValue = $this->VehiculoMotor->FormValue;
		$this->VehiculoCombustible->CurrentValue = $this->VehiculoCombustible->FormValue;
		$this->VehiculoTipoMedicion->CurrentValue = $this->VehiculoTipoMedicion->FormValue;
		$this->VehiculoCondicion->CurrentValue = $this->VehiculoCondicion->FormValue;
		$this->VehiculoKm->CurrentValue = $this->VehiculoKm->FormValue;
		$this->VehiculoFechaBaja->CurrentValue = $this->VehiculoFechaBaja->FormValue;
		$this->VehiculoFechaBaja->CurrentValue = ew_UnFormatDateTime($this->VehiculoFechaBaja->CurrentValue, 7);
		$this->VehiculoMotivoBaja->CurrentValue = $this->VehiculoMotivoBaja->FormValue;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $Language;
		$sFilter = $this->KeyFilter();

		// Call Row Selecting event
		$this->Row_Selecting($sFilter);

		// Load SQL based on filter
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn;
		if (!$rs || $rs->EOF) return;

		// Call Row Selected event
		$row = &$rs->fields;
		$this->Row_Selected($row);
		$this->VehiculoId->setDbValue($rs->fields('VehiculoId'));
		$this->VehiculoDominio->setDbValue($rs->fields('VehiculoDominio'));
		$this->VehiculoTipo->setDbValue($rs->fields('VehiculoTipo'));
		$this->VehiculoDescripcion->setDbValue($rs->fields('VehiculoDescripcion'));
		$this->VehiculoSucursal->setDbValue($rs->fields('VehiculoSucursal'));
		$this->VehiculoFechaCompra->setDbValue($rs->fields('VehiculoFechaCompra'));
		$this->VehiculoProveedor->setDbValue($rs->fields('VehiculoProveedor'));
		$this->VehiculoMarca->setDbValue($rs->fields('VehiculoMarca'));
		$this->VehiculoModelo->setDbValue($rs->fields('VehiculoModelo'));
		$this->VehiculoVersion->setDbValue($rs->fields('VehiculoVersion'));
		$this->VehiculoChasis->setDbValue($rs->fields('VehiculoChasis'));
		$this->VehiculoMotor->setDbValue($rs->fields('VehiculoMotor'));
		$this->VehiculoCombustible->setDbValue($rs->fields('VehiculoCombustible'));
		$this->VehiculoTipoMedicion->setDbValue($rs->fields('VehiculoTipoMedicion'));
		$this->VehiculoCondicion->setDbValue($rs->fields('VehiculoCondicion'));
		$this->VehiculoKm->setDbValue($rs->fields('VehiculoKm'));
		$this->VehiculoFotoPrincipal->Upload->DbValue = $rs->fields('VehiculoFotoPrincipal');
		$this->VehiculoFotoPrincipal->CurrentValue = $this->VehiculoFotoPrincipal->Upload->DbValue;
		$this->VehiculoFoto2->Upload->DbValue = $rs->fields('VehiculoFoto2');
		$this->VehiculoFoto2->CurrentValue = $this->VehiculoFoto2->Upload->DbValue;
		$this->VehiculoFoto3->Upload->DbValue = $rs->fields('VehiculoFoto3');
		$this->VehiculoFoto3->CurrentValue = $this->VehiculoFoto3->Upload->DbValue;
		$this->VehiculoFoto4->Upload->DbValue = $rs->fields('VehiculoFoto4');
		$this->VehiculoFoto4->CurrentValue = $this->VehiculoFoto4->Upload->DbValue;
		$this->VehiculoFechaBaja->setDbValue($rs->fields('VehiculoFechaBaja'));
		$this->VehiculoMotivoBaja->setDbValue($rs->fields('VehiculoMotivoBaja'));
	}

	// Load DbValue from recordset
	function LoadDbValues(&$rs) {
		if (!$rs || !is_array($rs) && $rs->EOF) return;
		$row = is_array($rs) ? $rs : $rs->fields;
		$this->VehiculoId->DbValue = $row['VehiculoId'];
		$this->VehiculoDominio->DbValue = $row['VehiculoDominio'];
		$this->VehiculoTipo->DbValue = $row['VehiculoTipo'];
		$this->VehiculoDescripcion->DbValue = $row['VehiculoDescripcion'];
		$this->VehiculoSucursal->DbValue = $row['VehiculoSucursal'];
		$this->VehiculoFechaCompra->DbValue = $row['VehiculoFechaCompra'];
		$this->VehiculoProveedor->DbValue = $row['VehiculoProveedor'];
		$this->VehiculoMarca->DbValue = $row['VehiculoMarca'];
		$this->VehiculoModelo->DbValue = $row['VehiculoModelo'];
		$this->VehiculoVersion->DbValue = $row['VehiculoVersion'];
		$this->VehiculoChasis->DbValue = $row['VehiculoChasis'];
		$this->VehiculoMotor->DbValue = $row['VehiculoMotor'];
		$this->VehiculoCombustible->DbValue = $row['VehiculoCombustible'];
		$this->VehiculoTipoMedicion->DbValue = $row['VehiculoTipoMedicion'];
		$this->VehiculoCondicion->DbValue = $row['VehiculoCondicion'];
		$this->VehiculoKm->DbValue = $row['VehiculoKm'];
		$this->VehiculoFotoPrincipal->Upload->DbValue = $row['VehiculoFotoPrincipal'];
		$this->VehiculoFoto2->Upload->DbValue = $row['VehiculoFoto2'];
		$this->VehiculoFoto3->Upload->DbValue = $row['VehiculoFoto3'];
		$this->VehiculoFoto4->Upload->DbValue = $row['VehiculoFoto4'];
		$this->VehiculoFechaBaja->DbValue = $row['VehiculoFechaBaja'];
		$this->VehiculoMotivoBaja->DbValue = $row['VehiculoMotivoBaja'];
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language;
		global $gsLanguage;

		// Initialize URLs
		// Convert decimal values if posted back

		if ($this->VehiculoKm->FormValue == $this->VehiculoKm->CurrentValue && is_numeric(ew_StrToFloat($this->VehiculoKm->CurrentValue)))
			$this->VehiculoKm->CurrentValue = ew_StrToFloat($this->VehiculoKm->CurrentValue);

		// Call Row_Rendering event
		$this->Row_Rendering();

		// Common render codes for all row types
		// VehiculoId
		// VehiculoDominio
		// VehiculoTipo
		// VehiculoDescripcion
		// VehiculoSucursal
		// VehiculoFechaCompra
		// VehiculoProveedor
		// VehiculoMarca
		// VehiculoModelo
		// VehiculoVersion
		// VehiculoChasis
		// VehiculoMotor
		// VehiculoCombustible
		// VehiculoTipoMedicion
		// VehiculoCondicion
		// VehiculoKm
		// VehiculoFotoPrincipal
		// VehiculoFoto2
		// VehiculoFoto3
		// VehiculoFoto4
		// VehiculoFechaBaja
		// VehiculoMotivoBaja

		if ($this->RowType == EW_ROWTYPE_VIEW) { // View row

			// VehiculoId
			$this->VehiculoId->ViewValue = $this->VehiculoId->CurrentValue;
			$this->VehiculoId->ViewCustomAttributes = "";

			// VehiculoDominio
			$this->VehiculoDominio->ViewValue = $this->VehiculoDominio->CurrentValue;
			$this->VehiculoDominio->ViewCustomAttributes = "";

			// VehiculoTipo
			if (strval($this->VehiculoTipo->CurrentValue) <> "") {
				$sFilterWrk = "`TipoId`" . ew_SearchString("=", $this->VehiculoTipo->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `TipoId`, `TipoNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `veh_tipo`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoTipo, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->VehiculoTipo->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->VehiculoTipo->ViewValue = $this->VehiculoTipo->CurrentValue;
				}
			} else {
				$this->VehiculoTipo->ViewValue = NULL;
			}
			$this->VehiculoTipo->ViewCustomAttributes = "";

			// VehiculoDescripcion
			$this->VehiculoDescripcion->ViewValue = $this->VehiculoDescripcion->CurrentValue;
			$this->VehiculoDescripcion->ViewCustomAttributes = "";

			// VehiculoSucursal
			if (strval($this->VehiculoSucursal->CurrentValue) <> "") {
				$sFilterWrk = "`sucursalId`" . ew_SearchString("=", $this->VehiculoSucursal->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `sucursalId`, `sucursalNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `sucursales`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoSucursal, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->VehiculoSucursal->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->VehiculoSucursal->ViewValue = $this->VehiculoSucursal->CurrentValue;
				}
			} else {
				$this->VehiculoSucursal->ViewValue = NULL;
			}
			$this->VehiculoSucursal->ViewCustomAttributes = "";

			// VehiculoFechaCompra
			$this->VehiculoFechaCompra->ViewValue = $this->VehiculoFechaCompra->CurrentValue;
			$this->VehiculoFechaCompra->ViewValue = ew_FormatDateTime($this->VehiculoFechaCompra->ViewValue, 7);
			$this->VehiculoFechaCompra->ViewCustomAttributes = "";

			// VehiculoProveedor
			if (strval($this->VehiculoProveedor->CurrentValue) <> "") {
				$sFilterWrk = "`ProveedorId`" . ew_SearchString("=", $this->VehiculoProveedor->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `ProveedorId`, `ProveedorNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `veh_proveedores`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoProveedor, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->VehiculoProveedor->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->VehiculoProveedor->ViewValue = $this->VehiculoProveedor->CurrentValue;
				}
			} else {
				$this->VehiculoProveedor->ViewValue = NULL;
			}
			$this->VehiculoProveedor->ViewCustomAttributes = "";

			// VehiculoMarca
			if (strval($this->VehiculoMarca->CurrentValue) <> "") {
				$sFilterWrk = "`MarcaId`" . ew_SearchString("=", $this->VehiculoMarca->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `MarcaId`, `MarcaNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `veh_marca`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoMarca, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->VehiculoMarca->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->VehiculoMarca->ViewValue = $this->VehiculoMarca->CurrentValue;
				}
			} else {
				$this->VehiculoMarca->ViewValue = NULL;
			}
			$this->VehiculoMarca->ViewCustomAttributes = "";

			// VehiculoModelo
			if (strval($this->VehiculoModelo->CurrentValue) <> "") {
				$sFilterWrk = "`ModeloId`" . ew_SearchString("=", $this->VehiculoModelo->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `ModeloId`, `ModeloNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `veh_modelo`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoModelo, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->VehiculoModelo->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->VehiculoModelo->ViewValue = $this->VehiculoModelo->CurrentValue;
				}
			} else {
				$this->VehiculoModelo->ViewValue = NULL;
			}
			$this->VehiculoModelo->ViewCustomAttributes = "";

			// VehiculoVersion
			if (strval($this->VehiculoVersion->CurrentValue) <> "") {
				$sFilterWrk = "`VersionId`" . ew_SearchString("=", $this->VehiculoVersion->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `VersionId`, `VersionNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `veh_version`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoVersion, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->VehiculoVersion->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->VehiculoVersion->ViewValue = $this->VehiculoVersion->CurrentValue;
				}
			} else {
				$this->VehiculoVersion->ViewValue = NULL;
			}
			$this->VehiculoVersion->ViewCustomAttributes = "";

			// VehiculoChasis
			$this->VehiculoChasis->ViewValue = $this->VehiculoChasis->CurrentValue;
			$this->VehiculoChasis->ViewCustomAttributes = "";

			// VehiculoMotor
			$this->VehiculoMotor->ViewValue = $this->VehiculoMotor->CurrentValue;
			$this->VehiculoMotor->ViewCustomAttributes = "";

			// VehiculoCombustible
			if (strval($this->VehiculoCombustible->CurrentValue) <> "") {
				$sFilterWrk = "`CombustibleId`" . ew_SearchString("=", $this->VehiculoCombustible->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `CombustibleId`, `CombustibleNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `veh_combustible`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoCombustible, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->VehiculoCombustible->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->VehiculoCombustible->ViewValue = $this->VehiculoCombustible->CurrentValue;
				}
			} else {
				$this->VehiculoCombustible->ViewValue = NULL;
			}
			$this->VehiculoCombustible->ViewCustomAttributes = "";

			// VehiculoTipoMedicion
			if (strval($this->VehiculoTipoMedicion->CurrentValue) <> "") {
				switch ($this->VehiculoTipoMedicion->CurrentValue) {
					case $this->VehiculoTipoMedicion->FldTagValue(1):
						$this->VehiculoTipoMedicion->ViewValue = $this->VehiculoTipoMedicion->FldTagCaption(1) <> "" ? $this->VehiculoTipoMedicion->FldTagCaption(1) : $this->VehiculoTipoMedicion->CurrentValue;
						break;
					case $this->VehiculoTipoMedicion->FldTagValue(2):
						$this->VehiculoTipoMedicion->ViewValue = $this->VehiculoTipoMedicion->FldTagCaption(2) <> "" ? $this->VehiculoTipoMedicion->FldTagCaption(2) : $this->VehiculoTipoMedicion->CurrentValue;
						break;
					case $this->VehiculoTipoMedicion->FldTagValue(3):
						$this->VehiculoTipoMedicion->ViewValue = $this->VehiculoTipoMedicion->FldTagCaption(3) <> "" ? $this->VehiculoTipoMedicion->FldTagCaption(3) : $this->VehiculoTipoMedicion->CurrentValue;
						break;
					default:
						$this->VehiculoTipoMedicion->ViewValue = $this->VehiculoTipoMedicion->CurrentValue;
				}
			} else {
				$this->VehiculoTipoMedicion->ViewValue = NULL;
			}
			$this->VehiculoTipoMedicion->ViewCustomAttributes = "";

			// VehiculoCondicion
			if (strval($this->VehiculoCondicion->CurrentValue) <> "") {
				switch ($this->VehiculoCondicion->CurrentValue) {
					case $this->VehiculoCondicion->FldTagValue(1):
						$this->VehiculoCondicion->ViewValue = $this->VehiculoCondicion->FldTagCaption(1) <> "" ? $this->VehiculoCondicion->FldTagCaption(1) : $this->VehiculoCondicion->CurrentValue;
						break;
					case $this->VehiculoCondicion->FldTagValue(2):
						$this->VehiculoCondicion->ViewValue = $this->VehiculoCondicion->FldTagCaption(2) <> "" ? $this->VehiculoCondicion->FldTagCaption(2) : $this->VehiculoCondicion->CurrentValue;
						break;
					default:
						$this->VehiculoCondicion->ViewValue = $this->VehiculoCondicion->CurrentValue;
				}
			} else {
				$this->VehiculoCondicion->ViewValue = NULL;
			}
			$this->VehiculoCondicion->ViewCustomAttributes = "";

			// VehiculoKm
			$this->VehiculoKm->ViewValue = $this->VehiculoKm->CurrentValue;
			$this->VehiculoKm->ViewCustomAttributes = "";

			// VehiculoFotoPrincipal
			if (!ew_Empty($this->VehiculoFotoPrincipal->Upload->DbValue)) {
				$this->VehiculoFotoPrincipal->ViewValue = $this->VehiculoFotoPrincipal->Upload->DbValue;
			} else {
				$this->VehiculoFotoPrincipal->ViewValue = "";
			}
			$this->VehiculoFotoPrincipal->ViewCustomAttributes = "";

			// VehiculoFoto2
			if (!ew_Empty($this->VehiculoFoto2->Upload->DbValue)) {
				$this->VehiculoFoto2->ViewValue = $this->VehiculoFoto2->Upload->DbValue;
			} else {
				$this->VehiculoFoto2->ViewValue = "";
			}
			$this->VehiculoFoto2->ViewCustomAttributes = "";

			// VehiculoFoto3
			if (!ew_Empty($this->VehiculoFoto3->Upload->DbValue)) {
				$this->VehiculoFoto3->ViewValue = $this->VehiculoFoto3->Upload->DbValue;
			} else {
				$this->VehiculoFoto3->ViewValue = "";
			}
			$this->VehiculoFoto3->ViewCustomAttributes = "";

			// VehiculoFoto4
			if (!ew_Empty($this->VehiculoFoto4->Upload->DbValue)) {
				$this->VehiculoFoto4->ViewValue = $this->VehiculoFoto4->Upload->DbValue;
			} else {
				$this->VehiculoFoto4->ViewValue = "";
			}
			$this->VehiculoFoto4->ViewCustomAttributes = "";

			// VehiculoFechaBaja
			$this->VehiculoFechaBaja->ViewValue = $this->VehiculoFechaBaja->CurrentValue;
			$this->VehiculoFechaBaja->ViewValue = ew_FormatDateTime($this->VehiculoFechaBaja->ViewValue, 7);
			$this->VehiculoFechaBaja->ViewCustomAttributes = "";

			// VehiculoMotivoBaja
			$this->VehiculoMotivoBaja->ViewValue = $this->VehiculoMotivoBaja->CurrentValue;
			$this->VehiculoMotivoBaja->ViewCustomAttributes = "";

			// VehiculoId
			$this->VehiculoId->LinkCustomAttributes = "";
			$this->VehiculoId->HrefValue = "";
			$this->VehiculoId->TooltipValue = "";

			// VehiculoDominio
			$this->VehiculoDominio->LinkCustomAttributes = "";
			$this->VehiculoDominio->HrefValue = "";
			$this->VehiculoDominio->TooltipValue = "";

			// VehiculoTipo
			$this->VehiculoTipo->LinkCustomAttributes = "";
			$this->VehiculoTipo->HrefValue = "";
			$this->VehiculoTipo->TooltipValue = "";

			// VehiculoDescripcion
			$this->VehiculoDescripcion->LinkCustomAttributes = "";
			$this->VehiculoDescripcion->HrefValue = "";
			$this->VehiculoDescripcion->TooltipValue = "";

			// VehiculoSucursal
			$this->VehiculoSucursal->LinkCustomAttributes = "";
			$this->VehiculoSucursal->HrefValue = "";
			$this->VehiculoSucursal->TooltipValue = "";

			// VehiculoFechaCompra
			$this->VehiculoFechaCompra->LinkCustomAttributes = "";
			$this->VehiculoFechaCompra->HrefValue = "";
			$this->VehiculoFechaCompra->TooltipValue = "";

			// VehiculoProveedor
			$this->VehiculoProveedor->LinkCustomAttributes = "";
			$this->VehiculoProveedor->HrefValue = "";
			$this->VehiculoProveedor->TooltipValue = "";

			// VehiculoMarca
			$this->VehiculoMarca->LinkCustomAttributes = "";
			$this->VehiculoMarca->HrefValue = "";
			$this->VehiculoMarca->TooltipValue = "";

			// VehiculoModelo
			$this->VehiculoModelo->LinkCustomAttributes = "";
			$this->VehiculoModelo->HrefValue = "";
			$this->VehiculoModelo->TooltipValue = "";

			// VehiculoVersion
			$this->VehiculoVersion->LinkCustomAttributes = "";
			$this->VehiculoVersion->HrefValue = "";
			$this->VehiculoVersion->TooltipValue = "";

			// VehiculoChasis
			$this->VehiculoChasis->LinkCustomAttributes = "";
			$this->VehiculoChasis->HrefValue = "";
			$this->VehiculoChasis->TooltipValue = "";

			// VehiculoMotor
			$this->VehiculoMotor->LinkCustomAttributes = "";
			$this->VehiculoMotor->HrefValue = "";
			$this->VehiculoMotor->TooltipValue = "";

			// VehiculoCombustible
			$this->VehiculoCombustible->LinkCustomAttributes = "";
			$this->VehiculoCombustible->HrefValue = "";
			$this->VehiculoCombustible->TooltipValue = "";

			// VehiculoTipoMedicion
			$this->VehiculoTipoMedicion->LinkCustomAttributes = "";
			$this->VehiculoTipoMedicion->HrefValue = "";
			$this->VehiculoTipoMedicion->TooltipValue = "";

			// VehiculoCondicion
			$this->VehiculoCondicion->LinkCustomAttributes = "";
			$this->VehiculoCondicion->HrefValue = "";
			$this->VehiculoCondicion->TooltipValue = "";

			// VehiculoKm
			$this->VehiculoKm->LinkCustomAttributes = "";
			$this->VehiculoKm->HrefValue = "";
			$this->VehiculoKm->TooltipValue = "";

			// VehiculoFotoPrincipal
			$this->VehiculoFotoPrincipal->LinkCustomAttributes = "";
			$this->VehiculoFotoPrincipal->HrefValue = "";
			$this->VehiculoFotoPrincipal->HrefValue2 = $this->VehiculoFotoPrincipal->UploadPath . $this->VehiculoFotoPrincipal->Upload->DbValue;
			$this->VehiculoFotoPrincipal->TooltipValue = "";

			// VehiculoFoto2
			$this->VehiculoFoto2->LinkCustomAttributes = "";
			$this->VehiculoFoto2->HrefValue = "";
			$this->VehiculoFoto2->HrefValue2 = $this->VehiculoFoto2->UploadPath . $this->VehiculoFoto2->Upload->DbValue;
			$this->VehiculoFoto2->TooltipValue = "";

			// VehiculoFoto3
			$this->VehiculoFoto3->LinkCustomAttributes = "";
			$this->VehiculoFoto3->HrefValue = "";
			$this->VehiculoFoto3->HrefValue2 = $this->VehiculoFoto3->UploadPath . $this->VehiculoFoto3->Upload->DbValue;
			$this->VehiculoFoto3->TooltipValue = "";

			// VehiculoFoto4
			$this->VehiculoFoto4->LinkCustomAttributes = "";
			$this->VehiculoFoto4->HrefValue = "";
			$this->VehiculoFoto4->HrefValue2 = $this->VehiculoFoto4->UploadPath . $this->VehiculoFoto4->Upload->DbValue;
			$this->VehiculoFoto4->TooltipValue = "";

			// VehiculoFechaBaja
			$this->VehiculoFechaBaja->LinkCustomAttributes = "";
			$this->VehiculoFechaBaja->HrefValue = "";
			$this->VehiculoFechaBaja->TooltipValue = "";

			// VehiculoMotivoBaja
			$this->VehiculoMotivoBaja->LinkCustomAttributes = "";
			$this->VehiculoMotivoBaja->HrefValue = "";
			$this->VehiculoMotivoBaja->TooltipValue = "";
		} elseif ($this->RowType == EW_ROWTYPE_EDIT) { // Edit row

			// VehiculoId
			$this->VehiculoId->EditCustomAttributes = "";
			$this->VehiculoId->EditValue = $this->VehiculoId->CurrentValue;
			$this->VehiculoId->ViewCustomAttributes = "";

			// VehiculoDominio
			$this->VehiculoDominio->EditCustomAttributes = "";
			$this->VehiculoDominio->EditValue = ew_HtmlEncode($this->VehiculoDominio->CurrentValue);
			$this->VehiculoDominio->PlaceHolder = ew_RemoveHtml($this->VehiculoDominio->FldCaption());

			// VehiculoTipo
			$this->VehiculoTipo->EditCustomAttributes = "";
			if (trim(strval($this->VehiculoTipo->CurrentValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$sFilterWrk = "`TipoId`" . ew_SearchString("=", $this->VehiculoTipo->CurrentValue, EW_DATATYPE_NUMBER);
			}
			$sSqlWrk = "SELECT `TipoId`, `TipoNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, '' AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `veh_tipo`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoTipo, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->VehiculoTipo->EditValue = $arwrk;

			// VehiculoDescripcion
			$this->VehiculoDescripcion->EditCustomAttributes = "";
			$this->VehiculoDescripcion->EditValue = ew_HtmlEncode($this->VehiculoDescripcion->CurrentValue);
			$this->VehiculoDescripcion->PlaceHolder = ew_RemoveHtml($this->VehiculoDescripcion->FldCaption());

			// VehiculoSucursal
			$this->VehiculoSucursal->EditCustomAttributes = "";
			if (trim(strval($this->VehiculoSucursal->CurrentValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$sFilterWrk = "`sucursalId`" . ew_SearchString("=", $this->VehiculoSucursal->CurrentValue, EW_DATATYPE_NUMBER);
			}
			$sSqlWrk = "SELECT `sucursalId`, `sucursalNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, '' AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `sucursales`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoSucursal, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->VehiculoSucursal->EditValue = $arwrk;

			// VehiculoFechaCompra
			$this->VehiculoFechaCompra->EditCustomAttributes = "";
			$this->VehiculoFechaCompra->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->VehiculoFechaCompra->CurrentValue, 7));
			$this->VehiculoFechaCompra->PlaceHolder = ew_RemoveHtml($this->VehiculoFechaCompra->FldCaption());

			// VehiculoProveedor
			$this->VehiculoProveedor->EditCustomAttributes = "";
			if (trim(strval($this->VehiculoProveedor->CurrentValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$sFilterWrk = "`ProveedorId`" . ew_SearchString("=", $this->VehiculoProveedor->CurrentValue, EW_DATATYPE_NUMBER);
			}
			$sSqlWrk = "SELECT `ProveedorId`, `ProveedorNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, '' AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `veh_proveedores`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoProveedor, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->VehiculoProveedor->EditValue = $arwrk;

			// VehiculoMarca
			$this->VehiculoMarca->EditCustomAttributes = "";
			if (trim(strval($this->VehiculoMarca->CurrentValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$sFilterWrk = "`MarcaId`" . ew_SearchString("=", $this->VehiculoMarca->CurrentValue, EW_DATATYPE_NUMBER);
			}
			$sSqlWrk = "SELECT `MarcaId`, `MarcaNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, '' AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `veh_marca`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoMarca, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->VehiculoMarca->EditValue = $arwrk;

			// VehiculoModelo
			$this->VehiculoModelo->EditCustomAttributes = "";
			if (trim(strval($this->VehiculoModelo->CurrentValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$sFilterWrk = "`ModeloId`" . ew_SearchString("=", $this->VehiculoModelo->CurrentValue, EW_DATATYPE_NUMBER);
			}
			$sSqlWrk = "SELECT `ModeloId`, `ModeloNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, `ModeloMarca` AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `veh_modelo`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoModelo, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->VehiculoModelo->EditValue = $arwrk;

			// VehiculoVersion
			$this->VehiculoVersion->EditCustomAttributes = "";
			if (trim(strval($this->VehiculoVersion->CurrentValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$sFilterWrk = "`VersionId`" . ew_SearchString("=", $this->VehiculoVersion->CurrentValue, EW_DATATYPE_NUMBER);
			}
			$sSqlWrk = "SELECT `VersionId`, `VersionNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, `VersionModelo` AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `veh_version`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoVersion, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->VehiculoVersion->EditValue = $arwrk;

			// VehiculoChasis
			$this->VehiculoChasis->EditCustomAttributes = "";
			$this->VehiculoChasis->EditValue = ew_HtmlEncode($this->VehiculoChasis->CurrentValue);
			$this->VehiculoChasis->PlaceHolder = ew_RemoveHtml($this->VehiculoChasis->FldCaption());

			// VehiculoMotor
			$this->VehiculoMotor->EditCustomAttributes = "";
			$this->VehiculoMotor->EditValue = ew_HtmlEncode($this->VehiculoMotor->CurrentValue);
			$this->VehiculoMotor->PlaceHolder = ew_RemoveHtml($this->VehiculoMotor->FldCaption());

			// VehiculoCombustible
			$this->VehiculoCombustible->EditCustomAttributes = "";
			if (trim(strval($this->VehiculoCombustible->CurrentValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$sFilterWrk = "`CombustibleId`" . ew_SearchString("=", $this->VehiculoCombustible->CurrentValue, EW_DATATYPE_NUMBER);
			}
			$sSqlWrk = "SELECT `CombustibleId`, `CombustibleNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, '' AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `veh_combustible`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->VehiculoCombustible, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->VehiculoCombustible->EditValue = $arwrk;

			// VehiculoTipoMedicion
			$this->VehiculoTipoMedicion->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array($this->VehiculoTipoMedicion->FldTagValue(1), $this->VehiculoTipoMedicion->FldTagCaption(1) <> "" ? $this->VehiculoTipoMedicion->FldTagCaption(1) : $this->VehiculoTipoMedicion->FldTagValue(1));
			$arwrk[] = array($this->VehiculoTipoMedicion->FldTagValue(2), $this->VehiculoTipoMedicion->FldTagCaption(2) <> "" ? $this->VehiculoTipoMedicion->FldTagCaption(2) : $this->VehiculoTipoMedicion->FldTagValue(2));
			$arwrk[] = array($this->VehiculoTipoMedicion->FldTagValue(3), $this->VehiculoTipoMedicion->FldTagCaption(3) <> "" ? $this->VehiculoTipoMedicion->FldTagCaption(3) : $this->VehiculoTipoMedicion->FldTagValue(3));
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
			$this->VehiculoTipoMedicion->EditValue = $arwrk;

			// VehiculoCondicion
			$this->VehiculoCondicion->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array($this->VehiculoCondicion->FldTagValue(1), $this->VehiculoCondicion->FldTagCaption(1) <> "" ? $this->VehiculoCondicion->FldTagCaption(1) : $this->VehiculoCondicion->FldTagValue(1));
			$arwrk[] = array($this->VehiculoCondicion->FldTagValue(2), $this->VehiculoCondicion->FldTagCaption(2) <> "" ? $this->VehiculoCondicion->FldTagCaption(2) : $this->VehiculoCondicion->FldTagValue(2));
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
			$this->VehiculoCondicion->EditValue = $arwrk;

			// VehiculoKm
			$this->VehiculoKm->EditCustomAttributes = "";
			$this->VehiculoKm->EditValue = ew_HtmlEncode($this->VehiculoKm->CurrentValue);
			$this->VehiculoKm->PlaceHolder = ew_RemoveHtml($this->VehiculoKm->FldCaption());
			if (strval($this->VehiculoKm->EditValue) <> "" && is_numeric($this->VehiculoKm->EditValue)) $this->VehiculoKm->EditValue = ew_FormatNumber($this->VehiculoKm->EditValue, -2, -1, -2, 0);

			// VehiculoFotoPrincipal
			$this->VehiculoFotoPrincipal->EditCustomAttributes = "";
			if (!ew_Empty($this->VehiculoFotoPrincipal->Upload->DbValue)) {
				$this->VehiculoFotoPrincipal->EditValue = $this->VehiculoFotoPrincipal->Upload->DbValue;
			} else {
				$this->VehiculoFotoPrincipal->EditValue = "";
			}
			if (!ew_Empty($this->VehiculoFotoPrincipal->CurrentValue))
				$this->VehiculoFotoPrincipal->Upload->FileName = $this->VehiculoFotoPrincipal->CurrentValue;
			if ($this->CurrentAction == "I" && !$this->EventCancelled) ew_RenderUploadField($this->VehiculoFotoPrincipal);

			// VehiculoFoto2
			$this->VehiculoFoto2->EditCustomAttributes = "";
			if (!ew_Empty($this->VehiculoFoto2->Upload->DbValue)) {
				$this->VehiculoFoto2->EditValue = $this->VehiculoFoto2->Upload->DbValue;
			} else {
				$this->VehiculoFoto2->EditValue = "";
			}
			if (!ew_Empty($this->VehiculoFoto2->CurrentValue))
				$this->VehiculoFoto2->Upload->FileName = $this->VehiculoFoto2->CurrentValue;
			if ($this->CurrentAction == "I" && !$this->EventCancelled) ew_RenderUploadField($this->VehiculoFoto2);

			// VehiculoFoto3
			$this->VehiculoFoto3->EditCustomAttributes = "";
			if (!ew_Empty($this->VehiculoFoto3->Upload->DbValue)) {
				$this->VehiculoFoto3->EditValue = $this->VehiculoFoto3->Upload->DbValue;
			} else {
				$this->VehiculoFoto3->EditValue = "";
			}
			if (!ew_Empty($this->VehiculoFoto3->CurrentValue))
				$this->VehiculoFoto3->Upload->FileName = $this->VehiculoFoto3->CurrentValue;
			if ($this->CurrentAction == "I" && !$this->EventCancelled) ew_RenderUploadField($this->VehiculoFoto3);

			// VehiculoFoto4
			$this->VehiculoFoto4->EditCustomAttributes = "";
			if (!ew_Empty($this->VehiculoFoto4->Upload->DbValue)) {
				$this->VehiculoFoto4->EditValue = $this->VehiculoFoto4->Upload->DbValue;
			} else {
				$this->VehiculoFoto4->EditValue = "";
			}
			if (!ew_Empty($this->VehiculoFoto4->CurrentValue))
				$this->VehiculoFoto4->Upload->FileName = $this->VehiculoFoto4->CurrentValue;
			if ($this->CurrentAction == "I" && !$this->EventCancelled) ew_RenderUploadField($this->VehiculoFoto4);

			// VehiculoFechaBaja
			$this->VehiculoFechaBaja->EditCustomAttributes = "";
			$this->VehiculoFechaBaja->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->VehiculoFechaBaja->CurrentValue, 7));
			$this->VehiculoFechaBaja->PlaceHolder = ew_RemoveHtml($this->VehiculoFechaBaja->FldCaption());

			// VehiculoMotivoBaja
			$this->VehiculoMotivoBaja->EditCustomAttributes = "";
			$this->VehiculoMotivoBaja->EditValue = ew_HtmlEncode($this->VehiculoMotivoBaja->CurrentValue);
			$this->VehiculoMotivoBaja->PlaceHolder = ew_RemoveHtml($this->VehiculoMotivoBaja->FldCaption());

			// Edit refer script
			// VehiculoId

			$this->VehiculoId->HrefValue = "";

			// VehiculoDominio
			$this->VehiculoDominio->HrefValue = "";

			// VehiculoTipo
			$this->VehiculoTipo->HrefValue = "";

			// VehiculoDescripcion
			$this->VehiculoDescripcion->HrefValue = "";

			// VehiculoSucursal
			$this->VehiculoSucursal->HrefValue = "";

			// VehiculoFechaCompra
			$this->VehiculoFechaCompra->HrefValue = "";

			// VehiculoProveedor
			$this->VehiculoProveedor->HrefValue = "";

			// VehiculoMarca
			$this->VehiculoMarca->HrefValue = "";

			// VehiculoModelo
			$this->VehiculoModelo->HrefValue = "";

			// VehiculoVersion
			$this->VehiculoVersion->HrefValue = "";

			// VehiculoChasis
			$this->VehiculoChasis->HrefValue = "";

			// VehiculoMotor
			$this->VehiculoMotor->HrefValue = "";

			// VehiculoCombustible
			$this->VehiculoCombustible->HrefValue = "";

			// VehiculoTipoMedicion
			$this->VehiculoTipoMedicion->HrefValue = "";

			// VehiculoCondicion
			$this->VehiculoCondicion->HrefValue = "";

			// VehiculoKm
			$this->VehiculoKm->HrefValue = "";

			// VehiculoFotoPrincipal
			$this->VehiculoFotoPrincipal->HrefValue = "";
			$this->VehiculoFotoPrincipal->HrefValue2 = $this->VehiculoFotoPrincipal->UploadPath . $this->VehiculoFotoPrincipal->Upload->DbValue;

			// VehiculoFoto2
			$this->VehiculoFoto2->HrefValue = "";
			$this->VehiculoFoto2->HrefValue2 = $this->VehiculoFoto2->UploadPath . $this->VehiculoFoto2->Upload->DbValue;

			// VehiculoFoto3
			$this->VehiculoFoto3->HrefValue = "";
			$this->VehiculoFoto3->HrefValue2 = $this->VehiculoFoto3->UploadPath . $this->VehiculoFoto3->Upload->DbValue;

			// VehiculoFoto4
			$this->VehiculoFoto4->HrefValue = "";
			$this->VehiculoFoto4->HrefValue2 = $this->VehiculoFoto4->UploadPath . $this->VehiculoFoto4->Upload->DbValue;

			// VehiculoFechaBaja
			$this->VehiculoFechaBaja->HrefValue = "";

			// VehiculoMotivoBaja
			$this->VehiculoMotivoBaja->HrefValue = "";
		}
		if ($this->RowType == EW_ROWTYPE_ADD ||
			$this->RowType == EW_ROWTYPE_EDIT ||
			$this->RowType == EW_ROWTYPE_SEARCH) { // Add / Edit / Search row
			$this->SetupFieldTitles();
		}

		// Call Row Rendered event
		if ($this->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$this->Row_Rendered();
	}

	// Validate form
	function ValidateForm() {
		global $Language, $gsFormError;

		// Initialize form error message
		$gsFormError = "";

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");
		if (!ew_CheckEuroDate($this->VehiculoFechaCompra->FormValue)) {
			ew_AddMessage($gsFormError, $this->VehiculoFechaCompra->FldErrMsg());
		}
		if (!ew_CheckNumber($this->VehiculoKm->FormValue)) {
			ew_AddMessage($gsFormError, $this->VehiculoKm->FldErrMsg());
		}
		if (!ew_CheckEuroDate($this->VehiculoFechaBaja->FormValue)) {
			ew_AddMessage($gsFormError, $this->VehiculoFechaBaja->FldErrMsg());
		}
		if (!ew_CheckInteger($this->VehiculoMotivoBaja->FormValue)) {
			ew_AddMessage($gsFormError, $this->VehiculoMotivoBaja->FldErrMsg());
		}

		// Validate detail grid
		$DetailTblVar = explode(",", $this->getCurrentDetailTable());
		if (in_array("vehiculo_cubiertas", $DetailTblVar) && $GLOBALS["vehiculo_cubiertas"]->DetailEdit) {
			if (!isset($GLOBALS["vehiculo_cubiertas_grid"])) $GLOBALS["vehiculo_cubiertas_grid"] = new cvehiculo_cubiertas_grid(); // get detail page object
			$GLOBALS["vehiculo_cubiertas_grid"]->ValidateGridForm();
		}
		if (in_array("veh_vehiculo_sucursal", $DetailTblVar) && $GLOBALS["veh_vehiculo_sucursal"]->DetailEdit) {
			if (!isset($GLOBALS["veh_vehiculo_sucursal_grid"])) $GLOBALS["veh_vehiculo_sucursal_grid"] = new cveh_vehiculo_sucursal_grid(); // get detail page object
			$GLOBALS["veh_vehiculo_sucursal_grid"]->ValidateGridForm();
		}

		// Return validate result
		$ValidateForm = ($gsFormError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			ew_AddMessage($gsFormError, $sFormCustomError);
		}
		return $ValidateForm;
	}

	// Update record based on key values
	function EditRow() {
		global $conn, $Security, $Language;
		$sFilter = $this->KeyFilter();
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$conn->raiseErrorFn = 'ew_ErrorFn';
		$rs = $conn->Execute($sSql);
		$conn->raiseErrorFn = '';
		if ($rs === FALSE)
			return FALSE;
		if ($rs->EOF) {
			$EditRow = FALSE; // Update Failed
		} else {

			// Begin transaction
			if ($this->getCurrentDetailTable() <> "")
				$conn->BeginTrans();

			// Save old values
			$rsold = &$rs->fields;
			$this->LoadDbValues($rsold);
			$rsnew = array();

			// VehiculoDominio
			$this->VehiculoDominio->SetDbValueDef($rsnew, $this->VehiculoDominio->CurrentValue, NULL, $this->VehiculoDominio->ReadOnly);

			// VehiculoTipo
			$this->VehiculoTipo->SetDbValueDef($rsnew, $this->VehiculoTipo->CurrentValue, NULL, $this->VehiculoTipo->ReadOnly);

			// VehiculoDescripcion
			$this->VehiculoDescripcion->SetDbValueDef($rsnew, $this->VehiculoDescripcion->CurrentValue, NULL, $this->VehiculoDescripcion->ReadOnly);

			// VehiculoSucursal
			$this->VehiculoSucursal->SetDbValueDef($rsnew, $this->VehiculoSucursal->CurrentValue, NULL, $this->VehiculoSucursal->ReadOnly);

			// VehiculoFechaCompra
			$this->VehiculoFechaCompra->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->VehiculoFechaCompra->CurrentValue, 7), NULL, $this->VehiculoFechaCompra->ReadOnly);

			// VehiculoProveedor
			$this->VehiculoProveedor->SetDbValueDef($rsnew, $this->VehiculoProveedor->CurrentValue, NULL, $this->VehiculoProveedor->ReadOnly);

			// VehiculoMarca
			$this->VehiculoMarca->SetDbValueDef($rsnew, $this->VehiculoMarca->CurrentValue, NULL, $this->VehiculoMarca->ReadOnly);

			// VehiculoModelo
			$this->VehiculoModelo->SetDbValueDef($rsnew, $this->VehiculoModelo->CurrentValue, NULL, $this->VehiculoModelo->ReadOnly);

			// VehiculoVersion
			$this->VehiculoVersion->SetDbValueDef($rsnew, $this->VehiculoVersion->CurrentValue, NULL, $this->VehiculoVersion->ReadOnly);

			// VehiculoChasis
			$this->VehiculoChasis->SetDbValueDef($rsnew, $this->VehiculoChasis->CurrentValue, NULL, $this->VehiculoChasis->ReadOnly);

			// VehiculoMotor
			$this->VehiculoMotor->SetDbValueDef($rsnew, $this->VehiculoMotor->CurrentValue, NULL, $this->VehiculoMotor->ReadOnly);

			// VehiculoCombustible
			$this->VehiculoCombustible->SetDbValueDef($rsnew, $this->VehiculoCombustible->CurrentValue, NULL, $this->VehiculoCombustible->ReadOnly);

			// VehiculoTipoMedicion
			$this->VehiculoTipoMedicion->SetDbValueDef($rsnew, $this->VehiculoTipoMedicion->CurrentValue, NULL, $this->VehiculoTipoMedicion->ReadOnly);

			// VehiculoCondicion
			$this->VehiculoCondicion->SetDbValueDef($rsnew, $this->VehiculoCondicion->CurrentValue, NULL, $this->VehiculoCondicion->ReadOnly);

			// VehiculoKm
			$this->VehiculoKm->SetDbValueDef($rsnew, $this->VehiculoKm->CurrentValue, NULL, $this->VehiculoKm->ReadOnly);

			// VehiculoFotoPrincipal
			if (!($this->VehiculoFotoPrincipal->ReadOnly) && !$this->VehiculoFotoPrincipal->Upload->KeepFile) {
				$this->VehiculoFotoPrincipal->Upload->DbValue = $rs->fields('VehiculoFotoPrincipal'); // Get original value
				if ($this->VehiculoFotoPrincipal->Upload->FileName == "") {
					$rsnew['VehiculoFotoPrincipal'] = NULL;
				} else {
					$rsnew['VehiculoFotoPrincipal'] = $this->VehiculoFotoPrincipal->Upload->FileName;
				}
			}

			// VehiculoFoto2
			if (!($this->VehiculoFoto2->ReadOnly) && !$this->VehiculoFoto2->Upload->KeepFile) {
				$this->VehiculoFoto2->Upload->DbValue = $rs->fields('VehiculoFoto2'); // Get original value
				if ($this->VehiculoFoto2->Upload->FileName == "") {
					$rsnew['VehiculoFoto2'] = NULL;
				} else {
					$rsnew['VehiculoFoto2'] = $this->VehiculoFoto2->Upload->FileName;
				}
			}

			// VehiculoFoto3
			if (!($this->VehiculoFoto3->ReadOnly) && !$this->VehiculoFoto3->Upload->KeepFile) {
				$this->VehiculoFoto3->Upload->DbValue = $rs->fields('VehiculoFoto3'); // Get original value
				if ($this->VehiculoFoto3->Upload->FileName == "") {
					$rsnew['VehiculoFoto3'] = NULL;
				} else {
					$rsnew['VehiculoFoto3'] = $this->VehiculoFoto3->Upload->FileName;
				}
			}

			// VehiculoFoto4
			if (!($this->VehiculoFoto4->ReadOnly) && !$this->VehiculoFoto4->Upload->KeepFile) {
				$this->VehiculoFoto4->Upload->DbValue = $rs->fields('VehiculoFoto4'); // Get original value
				if ($this->VehiculoFoto4->Upload->FileName == "") {
					$rsnew['VehiculoFoto4'] = NULL;
				} else {
					$rsnew['VehiculoFoto4'] = $this->VehiculoFoto4->Upload->FileName;
				}
			}

			// VehiculoFechaBaja
			$this->VehiculoFechaBaja->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->VehiculoFechaBaja->CurrentValue, 7), NULL, $this->VehiculoFechaBaja->ReadOnly);

			// VehiculoMotivoBaja
			$this->VehiculoMotivoBaja->SetDbValueDef($rsnew, $this->VehiculoMotivoBaja->CurrentValue, NULL, $this->VehiculoMotivoBaja->ReadOnly);
			if (!$this->VehiculoFotoPrincipal->Upload->KeepFile) {
				if (!ew_Empty($this->VehiculoFotoPrincipal->Upload->Value)) {
					$rsnew['VehiculoFotoPrincipal'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->VehiculoFotoPrincipal->UploadPath), $rsnew['VehiculoFotoPrincipal']); // Get new file name
				}
			}
			if (!$this->VehiculoFoto2->Upload->KeepFile) {
				if (!ew_Empty($this->VehiculoFoto2->Upload->Value)) {
					$rsnew['VehiculoFoto2'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->VehiculoFoto2->UploadPath), $rsnew['VehiculoFoto2']); // Get new file name
				}
			}
			if (!$this->VehiculoFoto3->Upload->KeepFile) {
				if (!ew_Empty($this->VehiculoFoto3->Upload->Value)) {
					$rsnew['VehiculoFoto3'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->VehiculoFoto3->UploadPath), $rsnew['VehiculoFoto3']); // Get new file name
				}
			}
			if (!$this->VehiculoFoto4->Upload->KeepFile) {
				if (!ew_Empty($this->VehiculoFoto4->Upload->Value)) {
					$rsnew['VehiculoFoto4'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->VehiculoFoto4->UploadPath), $rsnew['VehiculoFoto4']); // Get new file name
				}
			}

			// Call Row Updating event
			$bUpdateRow = $this->Row_Updating($rsold, $rsnew);
			if ($bUpdateRow) {
				$conn->raiseErrorFn = 'ew_ErrorFn';
				if (count($rsnew) > 0)
					$EditRow = $this->Update($rsnew, "", $rsold);
				else
					$EditRow = TRUE; // No field to update
				$conn->raiseErrorFn = '';
				if ($EditRow) {
					if (!$this->VehiculoFotoPrincipal->Upload->KeepFile) {
						if (!ew_Empty($this->VehiculoFotoPrincipal->Upload->Value)) {
							$this->VehiculoFotoPrincipal->Upload->SaveToFile($this->VehiculoFotoPrincipal->UploadPath, $rsnew['VehiculoFotoPrincipal'], TRUE);
						}
					}
					if (!$this->VehiculoFoto2->Upload->KeepFile) {
						if (!ew_Empty($this->VehiculoFoto2->Upload->Value)) {
							$this->VehiculoFoto2->Upload->SaveToFile($this->VehiculoFoto2->UploadPath, $rsnew['VehiculoFoto2'], TRUE);
						}
					}
					if (!$this->VehiculoFoto3->Upload->KeepFile) {
						if (!ew_Empty($this->VehiculoFoto3->Upload->Value)) {
							$this->VehiculoFoto3->Upload->SaveToFile($this->VehiculoFoto3->UploadPath, $rsnew['VehiculoFoto3'], TRUE);
						}
					}
					if (!$this->VehiculoFoto4->Upload->KeepFile) {
						if (!ew_Empty($this->VehiculoFoto4->Upload->Value)) {
							$this->VehiculoFoto4->Upload->SaveToFile($this->VehiculoFoto4->UploadPath, $rsnew['VehiculoFoto4'], TRUE);
						}
					}
				}

				// Update detail records
				if ($EditRow) {
					$DetailTblVar = explode(",", $this->getCurrentDetailTable());
					if (in_array("vehiculo_cubiertas", $DetailTblVar) && $GLOBALS["vehiculo_cubiertas"]->DetailEdit) {
						if (!isset($GLOBALS["vehiculo_cubiertas_grid"])) $GLOBALS["vehiculo_cubiertas_grid"] = new cvehiculo_cubiertas_grid(); // Get detail page object
						$EditRow = $GLOBALS["vehiculo_cubiertas_grid"]->GridUpdate();
					}
					if (in_array("veh_vehiculo_sucursal", $DetailTblVar) && $GLOBALS["veh_vehiculo_sucursal"]->DetailEdit) {
						if (!isset($GLOBALS["veh_vehiculo_sucursal_grid"])) $GLOBALS["veh_vehiculo_sucursal_grid"] = new cveh_vehiculo_sucursal_grid(); // Get detail page object
						$EditRow = $GLOBALS["veh_vehiculo_sucursal_grid"]->GridUpdate();
					}
				}

				// Commit/Rollback transaction
				if ($this->getCurrentDetailTable() <> "") {
					if ($EditRow) {
						$conn->CommitTrans(); // Commit transaction
					} else {
						$conn->RollbackTrans(); // Rollback transaction
					}
				}
			} else {
				if ($this->getSuccessMessage() <> "" || $this->getFailureMessage() <> "") {

					// Use the message, do nothing
				} elseif ($this->CancelMessage <> "") {
					$this->setFailureMessage($this->CancelMessage);
					$this->CancelMessage = "";
				} else {
					$this->setFailureMessage($Language->Phrase("UpdateCancelled"));
				}
				$EditRow = FALSE;
			}
		}

		// Call Row_Updated event
		if ($EditRow)
			$this->Row_Updated($rsold, $rsnew);
		$rs->Close();

		// VehiculoFotoPrincipal
		ew_CleanUploadTempPath($this->VehiculoFotoPrincipal, $this->VehiculoFotoPrincipal->Upload->Index);

		// VehiculoFoto2
		ew_CleanUploadTempPath($this->VehiculoFoto2, $this->VehiculoFoto2->Upload->Index);

		// VehiculoFoto3
		ew_CleanUploadTempPath($this->VehiculoFoto3, $this->VehiculoFoto3->Upload->Index);

		// VehiculoFoto4
		ew_CleanUploadTempPath($this->VehiculoFoto4, $this->VehiculoFoto4->Upload->Index);
		return $EditRow;
	}

	// Set up detail parms based on QueryString
	function SetUpDetailParms() {

		// Get the keys for master table
		if (isset($_GET[EW_TABLE_SHOW_DETAIL])) {
			$sDetailTblVar = $_GET[EW_TABLE_SHOW_DETAIL];
			$this->setCurrentDetailTable($sDetailTblVar);
		} else {
			$sDetailTblVar = $this->getCurrentDetailTable();
		}
		if ($sDetailTblVar <> "") {
			$DetailTblVar = explode(",", $sDetailTblVar);
			if (in_array("vehiculo_cubiertas", $DetailTblVar)) {
				if (!isset($GLOBALS["vehiculo_cubiertas_grid"]))
					$GLOBALS["vehiculo_cubiertas_grid"] = new cvehiculo_cubiertas_grid;
				if ($GLOBALS["vehiculo_cubiertas_grid"]->DetailEdit) {
					$GLOBALS["vehiculo_cubiertas_grid"]->CurrentMode = "edit";
					$GLOBALS["vehiculo_cubiertas_grid"]->CurrentAction = "gridedit";

					// Save current master table to detail table
					$GLOBALS["vehiculo_cubiertas_grid"]->setCurrentMasterTable($this->TableVar);
					$GLOBALS["vehiculo_cubiertas_grid"]->setStartRecordNumber(1);
					$GLOBALS["vehiculo_cubiertas_grid"]->VehVehiculo->FldIsDetailKey = TRUE;
					$GLOBALS["vehiculo_cubiertas_grid"]->VehVehiculo->CurrentValue = $this->VehiculoId->CurrentValue;
					$GLOBALS["vehiculo_cubiertas_grid"]->VehVehiculo->setSessionValue($GLOBALS["vehiculo_cubiertas_grid"]->VehVehiculo->CurrentValue);
				}
			}
			if (in_array("veh_vehiculo_sucursal", $DetailTblVar)) {
				if (!isset($GLOBALS["veh_vehiculo_sucursal_grid"]))
					$GLOBALS["veh_vehiculo_sucursal_grid"] = new cveh_vehiculo_sucursal_grid;
				if ($GLOBALS["veh_vehiculo_sucursal_grid"]->DetailEdit) {
					$GLOBALS["veh_vehiculo_sucursal_grid"]->CurrentMode = "edit";
					$GLOBALS["veh_vehiculo_sucursal_grid"]->CurrentAction = "gridedit";

					// Save current master table to detail table
					$GLOBALS["veh_vehiculo_sucursal_grid"]->setCurrentMasterTable($this->TableVar);
					$GLOBALS["veh_vehiculo_sucursal_grid"]->setStartRecordNumber(1);
					$GLOBALS["veh_vehiculo_sucursal_grid"]->Vehiculo->FldIsDetailKey = TRUE;
					$GLOBALS["veh_vehiculo_sucursal_grid"]->Vehiculo->CurrentValue = $this->VehiculoId->CurrentValue;
					$GLOBALS["veh_vehiculo_sucursal_grid"]->Vehiculo->setSessionValue($GLOBALS["veh_vehiculo_sucursal_grid"]->Vehiculo->CurrentValue);
				}
			}
		}
	}

	// Set up Breadcrumb
	function SetupBreadcrumb() {
		global $Breadcrumb, $Language;
		$Breadcrumb = new cBreadcrumb();
		$Breadcrumb->Add("list", $this->TableVar, "veh_vehiculoslist.php", $this->TableVar, TRUE);
		$PageId = "edit";
		$Breadcrumb->Add("edit", $PageId, ew_CurrentUrl());
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	// $type = ''|'success'|'failure'|'warning'
	function Message_Showing(&$msg, $type) {
		if ($type == 'success') {

			//$msg = "your success message";
		} elseif ($type == 'failure') {

			//$msg = "your failure message";
		} elseif ($type == 'warning') {

			//$msg = "your warning message";
		} else {

			//$msg = "your message";
		}
	}

	// Page Render event
	function Page_Render() {

		//echo "Page Render";
	}

	// Page Data Rendering event
	function Page_DataRendering(&$header) {

		// Example:
		//$header = "your header";

	}

	// Page Data Rendered event
	function Page_DataRendered(&$footer) {

		// Example:
		//$footer = "your footer";

	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}
}
?>
<?php ew_Header(FALSE) ?>
<?php

// Create page object
if (!isset($veh_vehiculos_edit)) $veh_vehiculos_edit = new cveh_vehiculos_edit();

// Page init
$veh_vehiculos_edit->Page_Init();

// Page main
$veh_vehiculos_edit->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$veh_vehiculos_edit->Page_Render();
?>
<?php include_once "header.php" ?>
<script type="text/javascript">

// Page object
var veh_vehiculos_edit = new ew_Page("veh_vehiculos_edit");
veh_vehiculos_edit.PageID = "edit"; // Page ID
var EW_PAGE_ID = veh_vehiculos_edit.PageID; // For backward compatibility

// Form object
var fveh_vehiculosedit = new ew_Form("fveh_vehiculosedit");

// Validate form
fveh_vehiculosedit.Validate = function() {
	if (!this.ValidateRequired)
		return true; // Ignore validation
	var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj);
	this.PostAutoSuggest();
	if ($fobj.find("#a_confirm").val() == "F")
		return true;
	var elm, felm, uelm, addcnt = 0;
	var $k = $fobj.find("#" + this.FormKeyCountName); // Get key_count
	var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
	var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
	var gridinsert = $fobj.find("#a_list").val() == "gridinsert";
	for (var i = startcnt; i <= rowcnt; i++) {
		var infix = ($k[0]) ? String(i) : "";
		$fobj.data("rowindex", infix);
			elm = this.GetElements("x" + infix + "_VehiculoFechaCompra");
			if (elm && !ew_CheckEuroDate(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($veh_vehiculos->VehiculoFechaCompra->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_VehiculoKm");
			if (elm && !ew_CheckNumber(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($veh_vehiculos->VehiculoKm->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_VehiculoFechaBaja");
			if (elm && !ew_CheckEuroDate(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($veh_vehiculos->VehiculoFechaBaja->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_VehiculoMotivoBaja");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($veh_vehiculos->VehiculoMotivoBaja->FldErrMsg()) ?>");

			// Set up row object
			ew_ElementsToRow(fobj);

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
	}

	// Process detail forms
	var dfs = $fobj.find("input[name='detailpage']").get();
	for (var i = 0; i < dfs.length; i++) {
		var df = dfs[i], val = df.value;
		if (val && ewForms[val])
			if (!ewForms[val].Validate())
				return false;
	}
	return true;
}

// Form_CustomValidate event
fveh_vehiculosedit.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
fveh_vehiculosedit.ValidateRequired = true;
<?php } else { ?>
fveh_vehiculosedit.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
fveh_vehiculosedit.Lists["x_VehiculoTipo"] = {"LinkField":"x_TipoId","Ajax":true,"AutoFill":false,"DisplayFields":["x_TipoNombre","","",""],"ParentFields":[],"FilterFields":[],"Options":[]};
fveh_vehiculosedit.Lists["x_VehiculoSucursal"] = {"LinkField":"x_sucursalId","Ajax":true,"AutoFill":false,"DisplayFields":["x_sucursalNombre","","",""],"ParentFields":[],"FilterFields":[],"Options":[]};
fveh_vehiculosedit.Lists["x_VehiculoProveedor"] = {"LinkField":"x_ProveedorId","Ajax":true,"AutoFill":false,"DisplayFields":["x_ProveedorNombre","","",""],"ParentFields":[],"FilterFields":[],"Options":[]};
fveh_vehiculosedit.Lists["x_VehiculoMarca"] = {"LinkField":"x_MarcaId","Ajax":true,"AutoFill":false,"DisplayFields":["x_MarcaNombre","","",""],"ParentFields":[],"FilterFields":[],"Options":[]};
fveh_vehiculosedit.Lists["x_VehiculoModelo"] = {"LinkField":"x_ModeloId","Ajax":true,"AutoFill":false,"DisplayFields":["x_ModeloNombre","","",""],"ParentFields":["x_VehiculoMarca"],"FilterFields":["x_ModeloMarca"],"Options":[]};
fveh_vehiculosedit.Lists["x_VehiculoVersion"] = {"LinkField":"x_VersionId","Ajax":true,"AutoFill":false,"DisplayFields":["x_VersionNombre","","",""],"ParentFields":["x_VehiculoModelo"],"FilterFields":["x_VersionModelo"],"Options":[]};
fveh_vehiculosedit.Lists["x_VehiculoCombustible"] = {"LinkField":"x_CombustibleId","Ajax":true,"AutoFill":false,"DisplayFields":["x_CombustibleNombre","","",""],"ParentFields":[],"FilterFields":[],"Options":[]};

// Form object for search
</script>
<script type="text/javascript">

// Write your client script here, no need to add script tags.
</script>
<?php $Breadcrumb->Render(); ?>
<?php $veh_vehiculos_edit->ShowPageHeader(); ?>
<?php
$veh_vehiculos_edit->ShowMessage();
?>
<form name="fveh_vehiculosedit" id="fveh_vehiculosedit" class="ewForm form-inline" action="<?php echo ew_CurrentPage() ?>" method="post">
<input type="hidden" name="t" value="veh_vehiculos">
<input type="hidden" name="a_edit" id="a_edit" value="U">
<table class="ewGrid"><tr><td>
<table id="tbl_veh_vehiculosedit" class="table table-bordered table-striped">
<?php if ($veh_vehiculos->VehiculoId->Visible) { // VehiculoId ?>
	<tr id="r_VehiculoId">
		<td><span id="elh_veh_vehiculos_VehiculoId"><?php echo $veh_vehiculos->VehiculoId->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoId->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoId" class="control-group">
<span<?php echo $veh_vehiculos->VehiculoId->ViewAttributes() ?>>
<?php echo $veh_vehiculos->VehiculoId->EditValue ?></span>
</span>
<input type="hidden" data-field="x_VehiculoId" name="x_VehiculoId" id="x_VehiculoId" value="<?php echo ew_HtmlEncode($veh_vehiculos->VehiculoId->CurrentValue) ?>">
<?php echo $veh_vehiculos->VehiculoId->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoDominio->Visible) { // VehiculoDominio ?>
	<tr id="r_VehiculoDominio">
		<td><span id="elh_veh_vehiculos_VehiculoDominio"><?php echo $veh_vehiculos->VehiculoDominio->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoDominio->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoDominio" class="control-group">
<input type="text" data-field="x_VehiculoDominio" name="x_VehiculoDominio" id="x_VehiculoDominio" size="10" maxlength="6" placeholder="<?php echo ew_HtmlEncode($veh_vehiculos->VehiculoDominio->PlaceHolder) ?>" value="<?php echo $veh_vehiculos->VehiculoDominio->EditValue ?>"<?php echo $veh_vehiculos->VehiculoDominio->EditAttributes() ?>>
</span>
<?php echo $veh_vehiculos->VehiculoDominio->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoTipo->Visible) { // VehiculoTipo ?>
	<tr id="r_VehiculoTipo">
		<td><span id="elh_veh_vehiculos_VehiculoTipo"><?php echo $veh_vehiculos->VehiculoTipo->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoTipo->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoTipo" class="control-group">
<select data-field="x_VehiculoTipo" id="x_VehiculoTipo" name="x_VehiculoTipo"<?php echo $veh_vehiculos->VehiculoTipo->EditAttributes() ?>>
<?php
if (is_array($veh_vehiculos->VehiculoTipo->EditValue)) {
	$arwrk = $veh_vehiculos->VehiculoTipo->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($veh_vehiculos->VehiculoTipo->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<?php
$sSqlWrk = "SELECT `TipoId`, `TipoNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `veh_tipo`";
$sWhereWrk = "";

// Call Lookup selecting
$veh_vehiculos->Lookup_Selecting($veh_vehiculos->VehiculoTipo, $sWhereWrk);
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x_VehiculoTipo" id="s_x_VehiculoTipo" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`TipoId` = {filter_value}"); ?>&amp;t0=3">
</span>
<?php echo $veh_vehiculos->VehiculoTipo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoDescripcion->Visible) { // VehiculoDescripcion ?>
	<tr id="r_VehiculoDescripcion">
		<td><span id="elh_veh_vehiculos_VehiculoDescripcion"><?php echo $veh_vehiculos->VehiculoDescripcion->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoDescripcion->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoDescripcion" class="control-group">
<input type="text" data-field="x_VehiculoDescripcion" name="x_VehiculoDescripcion" id="x_VehiculoDescripcion" size="30" maxlength="150" placeholder="<?php echo ew_HtmlEncode($veh_vehiculos->VehiculoDescripcion->PlaceHolder) ?>" value="<?php echo $veh_vehiculos->VehiculoDescripcion->EditValue ?>"<?php echo $veh_vehiculos->VehiculoDescripcion->EditAttributes() ?>>
</span>
<?php echo $veh_vehiculos->VehiculoDescripcion->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoSucursal->Visible) { // VehiculoSucursal ?>
	<tr id="r_VehiculoSucursal">
		<td><span id="elh_veh_vehiculos_VehiculoSucursal"><?php echo $veh_vehiculos->VehiculoSucursal->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoSucursal->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoSucursal" class="control-group">
<select data-field="x_VehiculoSucursal" id="x_VehiculoSucursal" name="x_VehiculoSucursal"<?php echo $veh_vehiculos->VehiculoSucursal->EditAttributes() ?>>
<?php
if (is_array($veh_vehiculos->VehiculoSucursal->EditValue)) {
	$arwrk = $veh_vehiculos->VehiculoSucursal->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($veh_vehiculos->VehiculoSucursal->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<?php
$sSqlWrk = "SELECT `sucursalId`, `sucursalNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `sucursales`";
$sWhereWrk = "";

// Call Lookup selecting
$veh_vehiculos->Lookup_Selecting($veh_vehiculos->VehiculoSucursal, $sWhereWrk);
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x_VehiculoSucursal" id="s_x_VehiculoSucursal" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`sucursalId` = {filter_value}"); ?>&amp;t0=3">
</span>
<?php echo $veh_vehiculos->VehiculoSucursal->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoFechaCompra->Visible) { // VehiculoFechaCompra ?>
	<tr id="r_VehiculoFechaCompra">
		<td><span id="elh_veh_vehiculos_VehiculoFechaCompra"><?php echo $veh_vehiculos->VehiculoFechaCompra->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoFechaCompra->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoFechaCompra" class="control-group">
<input type="text" data-field="x_VehiculoFechaCompra" name="x_VehiculoFechaCompra" id="x_VehiculoFechaCompra" size="11" placeholder="<?php echo ew_HtmlEncode($veh_vehiculos->VehiculoFechaCompra->PlaceHolder) ?>" value="<?php echo $veh_vehiculos->VehiculoFechaCompra->EditValue ?>"<?php echo $veh_vehiculos->VehiculoFechaCompra->EditAttributes() ?>>
<?php if (!$veh_vehiculos->VehiculoFechaCompra->ReadOnly && !$veh_vehiculos->VehiculoFechaCompra->Disabled && @$veh_vehiculos->VehiculoFechaCompra->EditAttrs["readonly"] == "" && @$veh_vehiculos->VehiculoFechaCompra->EditAttrs["disabled"] == "") { ?>
<button id="cal_x_VehiculoFechaCompra" name="cal_x_VehiculoFechaCompra" class="btn" type="button"><img src="phpimages/calendar.png" alt="<?php echo $Language->Phrase("PickDate") ?>" title="<?php echo $Language->Phrase("PickDate") ?>" style="border: 0;"></button><script type="text/javascript">
ew_CreateCalendar("fveh_vehiculosedit", "x_VehiculoFechaCompra", "%d/%m/%Y");
</script>
<?php } ?>
</span>
<?php echo $veh_vehiculos->VehiculoFechaCompra->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoProveedor->Visible) { // VehiculoProveedor ?>
	<tr id="r_VehiculoProveedor">
		<td><span id="elh_veh_vehiculos_VehiculoProveedor"><?php echo $veh_vehiculos->VehiculoProveedor->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoProveedor->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoProveedor" class="control-group">
<select data-field="x_VehiculoProveedor" id="x_VehiculoProveedor" name="x_VehiculoProveedor"<?php echo $veh_vehiculos->VehiculoProveedor->EditAttributes() ?>>
<?php
if (is_array($veh_vehiculos->VehiculoProveedor->EditValue)) {
	$arwrk = $veh_vehiculos->VehiculoProveedor->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($veh_vehiculos->VehiculoProveedor->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<?php
$sSqlWrk = "SELECT `ProveedorId`, `ProveedorNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `veh_proveedores`";
$sWhereWrk = "";

// Call Lookup selecting
$veh_vehiculos->Lookup_Selecting($veh_vehiculos->VehiculoProveedor, $sWhereWrk);
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x_VehiculoProveedor" id="s_x_VehiculoProveedor" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`ProveedorId` = {filter_value}"); ?>&amp;t0=3">
</span>
<?php echo $veh_vehiculos->VehiculoProveedor->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoMarca->Visible) { // VehiculoMarca ?>
	<tr id="r_VehiculoMarca">
		<td><span id="elh_veh_vehiculos_VehiculoMarca"><?php echo $veh_vehiculos->VehiculoMarca->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoMarca->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoMarca" class="control-group">
<?php $veh_vehiculos->VehiculoMarca->EditAttrs["onchange"] = "ew_UpdateOpt.call(this, ['x_VehiculoModelo']); " . @$veh_vehiculos->VehiculoMarca->EditAttrs["onchange"]; ?>
<select data-field="x_VehiculoMarca" id="x_VehiculoMarca" name="x_VehiculoMarca"<?php echo $veh_vehiculos->VehiculoMarca->EditAttributes() ?>>
<?php
if (is_array($veh_vehiculos->VehiculoMarca->EditValue)) {
	$arwrk = $veh_vehiculos->VehiculoMarca->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($veh_vehiculos->VehiculoMarca->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<?php
$sSqlWrk = "SELECT `MarcaId`, `MarcaNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `veh_marca`";
$sWhereWrk = "";

// Call Lookup selecting
$veh_vehiculos->Lookup_Selecting($veh_vehiculos->VehiculoMarca, $sWhereWrk);
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x_VehiculoMarca" id="s_x_VehiculoMarca" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`MarcaId` = {filter_value}"); ?>&amp;t0=3">
</span>
<?php echo $veh_vehiculos->VehiculoMarca->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoModelo->Visible) { // VehiculoModelo ?>
	<tr id="r_VehiculoModelo">
		<td><span id="elh_veh_vehiculos_VehiculoModelo"><?php echo $veh_vehiculos->VehiculoModelo->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoModelo->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoModelo" class="control-group">
<?php $veh_vehiculos->VehiculoModelo->EditAttrs["onchange"] = "ew_UpdateOpt.call(this, ['x_VehiculoVersion']); " . @$veh_vehiculos->VehiculoModelo->EditAttrs["onchange"]; ?>
<select data-field="x_VehiculoModelo" id="x_VehiculoModelo" name="x_VehiculoModelo"<?php echo $veh_vehiculos->VehiculoModelo->EditAttributes() ?>>
<?php
if (is_array($veh_vehiculos->VehiculoModelo->EditValue)) {
	$arwrk = $veh_vehiculos->VehiculoModelo->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($veh_vehiculos->VehiculoModelo->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<?php
$sSqlWrk = "SELECT `ModeloId`, `ModeloNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `veh_modelo`";
$sWhereWrk = "{filter}";

// Call Lookup selecting
$veh_vehiculos->Lookup_Selecting($veh_vehiculos->VehiculoModelo, $sWhereWrk);
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x_VehiculoModelo" id="s_x_VehiculoModelo" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`ModeloId` = {filter_value}"); ?>&amp;t0=3&amp;f1=<?php echo ew_Encrypt("`ModeloMarca` IN ({filter_value})"); ?>&amp;t1=3">
</span>
<?php echo $veh_vehiculos->VehiculoModelo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoVersion->Visible) { // VehiculoVersion ?>
	<tr id="r_VehiculoVersion">
		<td><span id="elh_veh_vehiculos_VehiculoVersion"><?php echo $veh_vehiculos->VehiculoVersion->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoVersion->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoVersion" class="control-group">
<select data-field="x_VehiculoVersion" id="x_VehiculoVersion" name="x_VehiculoVersion"<?php echo $veh_vehiculos->VehiculoVersion->EditAttributes() ?>>
<?php
if (is_array($veh_vehiculos->VehiculoVersion->EditValue)) {
	$arwrk = $veh_vehiculos->VehiculoVersion->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($veh_vehiculos->VehiculoVersion->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<?php
$sSqlWrk = "SELECT `VersionId`, `VersionNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `veh_version`";
$sWhereWrk = "{filter}";

// Call Lookup selecting
$veh_vehiculos->Lookup_Selecting($veh_vehiculos->VehiculoVersion, $sWhereWrk);
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x_VehiculoVersion" id="s_x_VehiculoVersion" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`VersionId` = {filter_value}"); ?>&amp;t0=3&amp;f1=<?php echo ew_Encrypt("`VersionModelo` IN ({filter_value})"); ?>&amp;t1=3">
</span>
<?php echo $veh_vehiculos->VehiculoVersion->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoChasis->Visible) { // VehiculoChasis ?>
	<tr id="r_VehiculoChasis">
		<td><span id="elh_veh_vehiculos_VehiculoChasis"><?php echo $veh_vehiculos->VehiculoChasis->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoChasis->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoChasis" class="control-group">
<input type="text" data-field="x_VehiculoChasis" name="x_VehiculoChasis" id="x_VehiculoChasis" size="30" maxlength="70" placeholder="<?php echo ew_HtmlEncode($veh_vehiculos->VehiculoChasis->PlaceHolder) ?>" value="<?php echo $veh_vehiculos->VehiculoChasis->EditValue ?>"<?php echo $veh_vehiculos->VehiculoChasis->EditAttributes() ?>>
</span>
<?php echo $veh_vehiculos->VehiculoChasis->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoMotor->Visible) { // VehiculoMotor ?>
	<tr id="r_VehiculoMotor">
		<td><span id="elh_veh_vehiculos_VehiculoMotor"><?php echo $veh_vehiculos->VehiculoMotor->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoMotor->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoMotor" class="control-group">
<input type="text" data-field="x_VehiculoMotor" name="x_VehiculoMotor" id="x_VehiculoMotor" size="30" maxlength="70" placeholder="<?php echo ew_HtmlEncode($veh_vehiculos->VehiculoMotor->PlaceHolder) ?>" value="<?php echo $veh_vehiculos->VehiculoMotor->EditValue ?>"<?php echo $veh_vehiculos->VehiculoMotor->EditAttributes() ?>>
</span>
<?php echo $veh_vehiculos->VehiculoMotor->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoCombustible->Visible) { // VehiculoCombustible ?>
	<tr id="r_VehiculoCombustible">
		<td><span id="elh_veh_vehiculos_VehiculoCombustible"><?php echo $veh_vehiculos->VehiculoCombustible->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoCombustible->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoCombustible" class="control-group">
<select data-field="x_VehiculoCombustible" id="x_VehiculoCombustible" name="x_VehiculoCombustible"<?php echo $veh_vehiculos->VehiculoCombustible->EditAttributes() ?>>
<?php
if (is_array($veh_vehiculos->VehiculoCombustible->EditValue)) {
	$arwrk = $veh_vehiculos->VehiculoCombustible->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($veh_vehiculos->VehiculoCombustible->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<?php
$sSqlWrk = "SELECT `CombustibleId`, `CombustibleNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `veh_combustible`";
$sWhereWrk = "";

// Call Lookup selecting
$veh_vehiculos->Lookup_Selecting($veh_vehiculos->VehiculoCombustible, $sWhereWrk);
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x_VehiculoCombustible" id="s_x_VehiculoCombustible" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`CombustibleId` = {filter_value}"); ?>&amp;t0=3">
</span>
<?php echo $veh_vehiculos->VehiculoCombustible->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoTipoMedicion->Visible) { // VehiculoTipoMedicion ?>
	<tr id="r_VehiculoTipoMedicion">
		<td><span id="elh_veh_vehiculos_VehiculoTipoMedicion"><?php echo $veh_vehiculos->VehiculoTipoMedicion->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoTipoMedicion->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoTipoMedicion" class="control-group">
<select data-field="x_VehiculoTipoMedicion" id="x_VehiculoTipoMedicion" name="x_VehiculoTipoMedicion"<?php echo $veh_vehiculos->VehiculoTipoMedicion->EditAttributes() ?>>
<?php
if (is_array($veh_vehiculos->VehiculoTipoMedicion->EditValue)) {
	$arwrk = $veh_vehiculos->VehiculoTipoMedicion->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($veh_vehiculos->VehiculoTipoMedicion->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
</span>
<?php echo $veh_vehiculos->VehiculoTipoMedicion->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoCondicion->Visible) { // VehiculoCondicion ?>
	<tr id="r_VehiculoCondicion">
		<td><span id="elh_veh_vehiculos_VehiculoCondicion"><?php echo $veh_vehiculos->VehiculoCondicion->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoCondicion->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoCondicion" class="control-group">
<select data-field="x_VehiculoCondicion" id="x_VehiculoCondicion" name="x_VehiculoCondicion"<?php echo $veh_vehiculos->VehiculoCondicion->EditAttributes() ?>>
<?php
if (is_array($veh_vehiculos->VehiculoCondicion->EditValue)) {
	$arwrk = $veh_vehiculos->VehiculoCondicion->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($veh_vehiculos->VehiculoCondicion->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
</span>
<?php echo $veh_vehiculos->VehiculoCondicion->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoKm->Visible) { // VehiculoKm ?>
	<tr id="r_VehiculoKm">
		<td><span id="elh_veh_vehiculos_VehiculoKm"><?php echo $veh_vehiculos->VehiculoKm->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoKm->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoKm" class="control-group">
<input type="text" data-field="x_VehiculoKm" name="x_VehiculoKm" id="x_VehiculoKm" size="30" placeholder="<?php echo ew_HtmlEncode($veh_vehiculos->VehiculoKm->PlaceHolder) ?>" value="<?php echo $veh_vehiculos->VehiculoKm->EditValue ?>"<?php echo $veh_vehiculos->VehiculoKm->EditAttributes() ?>>
</span>
<?php echo $veh_vehiculos->VehiculoKm->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoFotoPrincipal->Visible) { // VehiculoFotoPrincipal ?>
	<tr id="r_VehiculoFotoPrincipal">
		<td><span id="elh_veh_vehiculos_VehiculoFotoPrincipal"><?php echo $veh_vehiculos->VehiculoFotoPrincipal->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoFotoPrincipal->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoFotoPrincipal" class="control-group">
<span id="fd_x_VehiculoFotoPrincipal">
<span class="btn btn-small fileinput-button"<?php if ($veh_vehiculos->VehiculoFotoPrincipal->ReadOnly || $veh_vehiculos->VehiculoFotoPrincipal->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_VehiculoFotoPrincipal" name="x_VehiculoFotoPrincipal" id="x_VehiculoFotoPrincipal">
</span>
<input type="hidden" name="fn_x_VehiculoFotoPrincipal" id= "fn_x_VehiculoFotoPrincipal" value="<?php echo $veh_vehiculos->VehiculoFotoPrincipal->Upload->FileName ?>">
<?php if (@$_POST["fa_x_VehiculoFotoPrincipal"] == "0") { ?>
<input type="hidden" name="fa_x_VehiculoFotoPrincipal" id= "fa_x_VehiculoFotoPrincipal" value="0">
<?php } else { ?>
<input type="hidden" name="fa_x_VehiculoFotoPrincipal" id= "fa_x_VehiculoFotoPrincipal" value="1">
<?php } ?>
<input type="hidden" name="fs_x_VehiculoFotoPrincipal" id= "fs_x_VehiculoFotoPrincipal" value="50">
</span>
<table id="ft_x_VehiculoFotoPrincipal" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</span>
<?php echo $veh_vehiculos->VehiculoFotoPrincipal->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoFoto2->Visible) { // VehiculoFoto2 ?>
	<tr id="r_VehiculoFoto2">
		<td><span id="elh_veh_vehiculos_VehiculoFoto2"><?php echo $veh_vehiculos->VehiculoFoto2->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoFoto2->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoFoto2" class="control-group">
<span id="fd_x_VehiculoFoto2">
<span class="btn btn-small fileinput-button"<?php if ($veh_vehiculos->VehiculoFoto2->ReadOnly || $veh_vehiculos->VehiculoFoto2->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_VehiculoFoto2" name="x_VehiculoFoto2" id="x_VehiculoFoto2">
</span>
<input type="hidden" name="fn_x_VehiculoFoto2" id= "fn_x_VehiculoFoto2" value="<?php echo $veh_vehiculos->VehiculoFoto2->Upload->FileName ?>">
<?php if (@$_POST["fa_x_VehiculoFoto2"] == "0") { ?>
<input type="hidden" name="fa_x_VehiculoFoto2" id= "fa_x_VehiculoFoto2" value="0">
<?php } else { ?>
<input type="hidden" name="fa_x_VehiculoFoto2" id= "fa_x_VehiculoFoto2" value="1">
<?php } ?>
<input type="hidden" name="fs_x_VehiculoFoto2" id= "fs_x_VehiculoFoto2" value="50">
</span>
<table id="ft_x_VehiculoFoto2" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</span>
<?php echo $veh_vehiculos->VehiculoFoto2->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoFoto3->Visible) { // VehiculoFoto3 ?>
	<tr id="r_VehiculoFoto3">
		<td><span id="elh_veh_vehiculos_VehiculoFoto3"><?php echo $veh_vehiculos->VehiculoFoto3->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoFoto3->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoFoto3" class="control-group">
<span id="fd_x_VehiculoFoto3">
<span class="btn btn-small fileinput-button"<?php if ($veh_vehiculos->VehiculoFoto3->ReadOnly || $veh_vehiculos->VehiculoFoto3->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_VehiculoFoto3" name="x_VehiculoFoto3" id="x_VehiculoFoto3">
</span>
<input type="hidden" name="fn_x_VehiculoFoto3" id= "fn_x_VehiculoFoto3" value="<?php echo $veh_vehiculos->VehiculoFoto3->Upload->FileName ?>">
<?php if (@$_POST["fa_x_VehiculoFoto3"] == "0") { ?>
<input type="hidden" name="fa_x_VehiculoFoto3" id= "fa_x_VehiculoFoto3" value="0">
<?php } else { ?>
<input type="hidden" name="fa_x_VehiculoFoto3" id= "fa_x_VehiculoFoto3" value="1">
<?php } ?>
<input type="hidden" name="fs_x_VehiculoFoto3" id= "fs_x_VehiculoFoto3" value="50">
</span>
<table id="ft_x_VehiculoFoto3" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</span>
<?php echo $veh_vehiculos->VehiculoFoto3->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoFoto4->Visible) { // VehiculoFoto4 ?>
	<tr id="r_VehiculoFoto4">
		<td><span id="elh_veh_vehiculos_VehiculoFoto4"><?php echo $veh_vehiculos->VehiculoFoto4->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoFoto4->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoFoto4" class="control-group">
<span id="fd_x_VehiculoFoto4">
<span class="btn btn-small fileinput-button"<?php if ($veh_vehiculos->VehiculoFoto4->ReadOnly || $veh_vehiculos->VehiculoFoto4->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_VehiculoFoto4" name="x_VehiculoFoto4" id="x_VehiculoFoto4">
</span>
<input type="hidden" name="fn_x_VehiculoFoto4" id= "fn_x_VehiculoFoto4" value="<?php echo $veh_vehiculos->VehiculoFoto4->Upload->FileName ?>">
<?php if (@$_POST["fa_x_VehiculoFoto4"] == "0") { ?>
<input type="hidden" name="fa_x_VehiculoFoto4" id= "fa_x_VehiculoFoto4" value="0">
<?php } else { ?>
<input type="hidden" name="fa_x_VehiculoFoto4" id= "fa_x_VehiculoFoto4" value="1">
<?php } ?>
<input type="hidden" name="fs_x_VehiculoFoto4" id= "fs_x_VehiculoFoto4" value="50">
</span>
<table id="ft_x_VehiculoFoto4" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</span>
<?php echo $veh_vehiculos->VehiculoFoto4->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoFechaBaja->Visible) { // VehiculoFechaBaja ?>
	<tr id="r_VehiculoFechaBaja">
		<td><span id="elh_veh_vehiculos_VehiculoFechaBaja"><?php echo $veh_vehiculos->VehiculoFechaBaja->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoFechaBaja->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoFechaBaja" class="control-group">
<input type="text" data-field="x_VehiculoFechaBaja" name="x_VehiculoFechaBaja" id="x_VehiculoFechaBaja" placeholder="<?php echo ew_HtmlEncode($veh_vehiculos->VehiculoFechaBaja->PlaceHolder) ?>" value="<?php echo $veh_vehiculos->VehiculoFechaBaja->EditValue ?>"<?php echo $veh_vehiculos->VehiculoFechaBaja->EditAttributes() ?>>
</span>
<?php echo $veh_vehiculos->VehiculoFechaBaja->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($veh_vehiculos->VehiculoMotivoBaja->Visible) { // VehiculoMotivoBaja ?>
	<tr id="r_VehiculoMotivoBaja">
		<td><span id="elh_veh_vehiculos_VehiculoMotivoBaja"><?php echo $veh_vehiculos->VehiculoMotivoBaja->FldCaption() ?></span></td>
		<td<?php echo $veh_vehiculos->VehiculoMotivoBaja->CellAttributes() ?>>
<span id="el_veh_vehiculos_VehiculoMotivoBaja" class="control-group">
<input type="text" data-field="x_VehiculoMotivoBaja" name="x_VehiculoMotivoBaja" id="x_VehiculoMotivoBaja" size="30" placeholder="<?php echo ew_HtmlEncode($veh_vehiculos->VehiculoMotivoBaja->PlaceHolder) ?>" value="<?php echo $veh_vehiculos->VehiculoMotivoBaja->EditValue ?>"<?php echo $veh_vehiculos->VehiculoMotivoBaja->EditAttributes() ?>>
</span>
<?php echo $veh_vehiculos->VehiculoMotivoBaja->CustomMsg ?></td>
	</tr>
<?php } ?>
</table>
</td></tr></table>
<?php
	if (in_array("vehiculo_cubiertas", explode(",", $veh_vehiculos->getCurrentDetailTable())) && $vehiculo_cubiertas->DetailEdit) {
?>
<?php include_once "vehiculo_cubiertasgrid.php" ?>
<?php } ?>
<?php
	if (in_array("veh_vehiculo_sucursal", explode(",", $veh_vehiculos->getCurrentDetailTable())) && $veh_vehiculo_sucursal->DetailEdit) {
?>
<?php include_once "veh_vehiculo_sucursalgrid.php" ?>
<?php } ?>
<button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><?php echo $Language->Phrase("EditBtn") ?></button>
</form>
<script type="text/javascript">
fveh_vehiculosedit.Init();
<?php if (EW_MOBILE_REFLOW && ew_IsMobile()) { ?>
ew_Reflow();
<?php } ?>
</script>
<?php
$veh_vehiculos_edit->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<script type="text/javascript">

// Write your table-specific startup script here
// document.write("page loaded");

</script>
<?php include_once "footer.php" ?>
<?php
$veh_vehiculos_edit->Page_Terminate();
?>
